<template>
  <div class="detail-info" v-if="goods.services">
    <div class="detail-info-titile">{{goods.title}}</div>
    <div class="detail-info-price">
      <span>{{goods.price}}</span>
      <span>{{goods.oldPrice}}</span>
      <span v-if="goods.discountDesc" :style="{backgroundColor:goods.discountBgColor}">{{goods.discountDesc}}</span>
    </div>
    <div class="detail-info-sell">
      <div>{{goods.sell}}</div>
      <div>{{goods.fans}}</div>
      <div>{{goods.services[goods.services.length-1].name}}</div>
    </div>
    <div class="detail-info-service">
      <div v-for="index in goods.services.length-1" :key="index">
        <img v-if="goods.services[index-1].icon" :src="goods.services[index-1].icon" alt="">
        <span>{{goods.services[index-1].name}}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    goods: {
      type: Object,
      default() {
        return {}
      }
    }
  }

}
</script>

<style scoped>
.detail-info {
  padding: 8px 8px;
}

.detail-info-titile {
  font-size: 16px;
  font-weight: 550;
  margin-bottom: 8px;
}

.detail-info-price span:nth-child(1) {
  color: red;
  font-size: 25px;
}

.detail-info-price span:nth-child(2) {
  font-size: 12px;
  padding-left: 5px;
  text-decoration: line-through;
}

.detail-info-price span:nth-child(3) {
  position: relative;
  left: 5px;
  bottom: 8px;
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  padding: 1px 3px;
}

.detail-info-sell {
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  margin: 15px 0 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid #ddd;
}

.detail-info-sell div{
  text-align: center;
  /* flex: 1; */
  color: #888;
}


.detail-info-service {
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  white-space: nowrap;
  font-size: 12px;
  color: black;
  vertical-align: middle;
}

.detail-info-service div {
  line-height: 18px;
}

.detail-info-service img {
  position: relative;
  top: 3px;
  right: 3px;
  width: 15px;
}
</style>